#version 130

attribute vec3 vertex;
attribute vec3 normal;
attribute vec3 tangent;
attribute vec3 color;
attribute vec2 UV;

uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat4 ViewProjectionMatrix;
uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix;

varying vec3 outNormal;
varying vec2 outUV;
varying vec3 position;
varying vec3 worldVertexPosition;
varying vec3 worldNormalDirection;

void main() {
	gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(vertex,1.0);
	//gl_Position = ModelViewProjectionMatrix * vec4(vertex,1.0);
	position = vec3(ModelViewMatrix * vec4(vertex,1.0));
	outNormal = NormalMatrix * normal;
	outUV = UV;
	
	worldVertexPosition = vec3(ModelMatrix * vec4(vertex, 1.0));
	worldNormalDirection = mat3(ModelMatrix) * normal;
}